<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增医废 报模版 配置')"/>
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-reports-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">医院：</label>
            <div class="col-sm-8">
                <select name="hospitalId" id="hospitalId" class="form-control m-b" th:with="type=${@dep.getDep()}"
                        required>
                    <option value="">请选择</option>
                    <option th:each="dep : ${type}" th:text="${dep.deptName}" th:value="${dep.deptId}"></option>
                </select>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">报表名称：</label>
            <div class="col-sm-8">
                <input name="rTName" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">模版标题：</label>
            <div class="col-sm-8">
                <input name="rTTitle" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">上传模版：</label>
            <div class="col-sm-8">
                <!--<input name="rTPath" class="form-control" type="text">-->
                <input id="rTPath" name="rTPath" type="file" multiple>
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-3 control-label">json数据：</label>
            <div class="col-sm-8">
                <textarea name="rTJson" class="form-control full"></textarea>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> <a>帮助</a></span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">sql语句 ：</label>
            <div class="col-sm-8">
                <textarea name="rTSql" class="form-control full-lg"></textarea>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只可使用 select 查询 "yf_"开头的表</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">状态：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
                    <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}"
                           th:checked="${dict.default}">
                    <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">回显名称排序：</label>
            <div class="col-sm-8">
                <textarea name="selectNameSort" class="form-control"></textarea>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> select 名称排序以逗号分隔:i1,d2,l4</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">列合计：</label>
            <div class="col-sm-8">
                <div class="radio-box" th:each="dict : ${@dict.getType('sys_show_hide')}">
                    <input type="radio" th:id="${'columnSum_' + dict.dictCode}" name="columnSum" th:value="${dict.dictValue}" th:checked="${dict.default}">
                    <label th:for="${'columnSum_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea id="remark" name="remark" maxlength="400" class="form-control" ></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<script type="text/javascript">
    var prefix = ctx + "yf/reports"

    $("#rTPath").fileinput({
        'theme': 'explorer-fas',
        'uploadUrl': '#',
        dropZoneEnabled: false,
        showPreview: false,
        maxFileCount: 1,
        showUpload: false,
        allowedFileExtensions: ['xlsx']
    })
        //上传成功后处理方法
        .on("fileuploaded", function (event, data, previewId, index) {
        })
        //选择文件后处理事件
        .on("filebatchselected", function (event, files) {
            //文件上传方法
            $("#rTPath").fileinput("upload");
        })
        // 异步上传成功结果处理
        .on("fileuploaded", function (event, data, previewId, index) {
        })
        // 异步上传错误结果处理
        .on('fileerror', function (event, data, msg) {
        });

    $("#form-reports-add").validate({
        focusCleanup: true
    });


    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-reports-add').serialize());
        }
    }
</script>
</body>
</html>